﻿//Diamond.as 该类为菱形绘制
//vesion 1.0
//author 夏天的树人
package org.summerTree.graphics
{
	import flash.geom.Point;
	public class Diamond extends Base 
	{
		public function Diamond()
		{
          
		}	
		
		override public function clone():*
		{
			return new Diamond();
		}
			
		
		/*radius 长度
		 *
		 *fillColor 填充颜色
		 *alpha 透明度填充透明度		
		 */		 
		public function CreatDiamond(radius:Number,fillColor:uint=0xffffff,alpha:Number=1):void
		{			
			this.graphics.lineStyle(1,color);
			 
			//var tempArray:Array=[[2*radius,radius/2],
//							     [radius,0],
//								 [0,radius/2],
//							     [radius,radius]										   
//										  ];
			var tempArray:Array=[[radius,0],
							     [0,-radius/2],
								 [-radius,0],
							     [0,radius/2]										   
										  ];
			this.graphics.beginFill(fillColor,alpha);
			this.graphics.moveTo(tempArray[0][0],tempArray[0][1]);
			for (var j:int=1; j < 4; j++)
			{ 
				drawPoint(new Point(tempArray[j][0],tempArray[j][1]));
			}
			this.graphics.lineTo(tempArray[0][0],tempArray[0][1]);
			this.graphics.endFill();					
		}
		
		//绘制线程序
		private function drawPoint(point:Point):void
		{
			this.graphics.lineTo(point.x,point.y);
		}
		
		//public function clear():void
//		{
//			this.graphics.clear();
//		}		
	}
}